<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        class Person {
            constructor(name, age) { // 构造函数，调用new 自动执行
                this.name = name;
                this.age = age;
                this.showname = this.showname.bind(tihs); // 矫正
            };

            showname() {
                return `名字: ${this.name}`
            };
        };

        let p1 = new Person('小名', 10);
        console.log(p1.showname());

        let {
            showname
        } = p1
        console.log(showname());
    </script>
</body>

</html>